import { createApp } from "vue";
import { createPinia } from "pinia";
import { setToastDefaultOptions } from "vant";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import App from "./App.vue";

import visible from "./directives/visible";

// 引入路由器实例
import router from "./router";

// 引入 Vant 中一些 函数调用方式的组件的样式（因为 unplugin-vue-components 无法处理这种类型的情况）
import "vant/es/toast/style";
import "vant/es/dialog/style";

// 设置 Toast 的一些配置参数
setToastDefaultOptions("loading", {
  duration: 0,
});

const app = createApp(App);
app.use(router);
app.use(createPinia().use(piniaPluginPersistedstate));

// 注册一个全局指令
app.directive("visible", visible);

app.mount("#app");
